package server.gui;

import java.awt.Color;
import java.awt.Font;
import java.awt.List;
import java.util.Iterator;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;

import model.Usuario;


@SuppressWarnings("rawtypes")
public class PantallaPerfilUsuario {
	private JFrame frame;
	private JButton btnImagenPerfil;		
	private JButton btnIzquierdo;		
	private JButton btnCentral;		
	private JButton btnDerecho;
	private JLabel lblNyApe; 
	private JLabel lblUsuario;	
	private JLabel lblAmigosEnComun;
	private List list;
	
	/**
	 * Create the application.
	 */
	public PantallaPerfilUsuario(String nombreYApellido, String usuario,
								 java.util.List amigosEnComun, String botonIzquierdo,
								 String botonCentral,String botonDerecho) {
		
		initialize(nombreYApellido, usuario, amigosEnComun, botonCentral,
				   botonIzquierdo,botonDerecho);
	}

	/**
	 * Initialize the contents of the frame.
	 * @param botonDerecho 
	 * @param botonIzquierdo 
	 * @param botonCentral 
	 * @param amigosEnComun 
	 * @param domicilio 
	 * @param usuario 
	 * @param nombreYApellido 
	 */
	private void initialize(String nombreYApellido, String usuario,
							java.util.List amigosEnComun, String botonCentral, String botonIzquierdo,
							String botonDerecho) {
		
		frame = new JFrame();
		frame.setTitle("Perfil de \"USUARIO2\"");
		frame.setBounds(100, 100, 587, 420);
		frame.setAlwaysOnTop(true);
		
		btnImagenPerfil = new JButton("");
		btnImagenPerfil.setBackground(Color.MAGENTA);
		btnImagenPerfil.setFont(new Font("Tahoma", Font.PLAIN, 18));
		btnImagenPerfil.setIcon(new ImageIcon("C:\\Documents and Settings\\B031596\\Desktop\\Mono Social Icons\\Mono Social Set - PNG\\PNG white\\white_500px.png"));

		btnCentral = new JButton(botonCentral);		
		btnIzquierdo = new JButton(botonIzquierdo);		
		btnDerecho = new JButton(botonDerecho);
		
		lblNyApe = new JLabel(nombreYApellido);
		lblNyApe.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		lblUsuario = new JLabel(usuario);
		lblUsuario.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		lblAmigosEnComun = new JLabel("Amigos en Comun:");
		lblAmigosEnComun.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		list = new List();
		
		Iterator i = amigosEnComun.iterator();
		while(i.hasNext())
			this.list.add(((Usuario) i.next()).getNick());
		
		GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(28)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addComponent(btnImagenPerfil, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
							.addGap(35))
						.addGroup(groupLayout.createSequentialGroup()
							.addComponent(btnIzquierdo, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)))
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
							.addGroup(groupLayout.createSequentialGroup()
								.addGap(39)
								.addComponent(btnCentral, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addComponent(btnDerecho, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE))
							.addComponent(list, GroupLayout.PREFERRED_SIZE, 371, GroupLayout.PREFERRED_SIZE))
						.addComponent(lblAmigosEnComun, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblNyApe, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblUsuario, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE))
					.addGap(23))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(26)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(17)
							.addComponent(lblNyApe, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
							.addGap(13)
							.addComponent(lblUsuario, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.UNRELATED)
							.addComponent(lblAmigosEnComun, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE))
						.addComponent(btnImagenPerfil, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addComponent(list, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
					.addGap(27)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(btnDerecho, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE)
						.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
							.addComponent(btnIzquierdo, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE)
							.addComponent(btnCentral, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap(28, Short.MAX_VALUE))
		);
		frame.getContentPane().setLayout(groupLayout);		
		frame.setVisible(true);	
		
	}

	public JFrame getFrame() {
		return frame;
	}

	public void setFrame(JFrame frame) {
		this.frame = frame;
	}

	public JButton getBtnImagenPerfil() {
		return btnImagenPerfil;
	}

	public void setBtnImagenPerfil(JButton btnImagenPerfil) {
		this.btnImagenPerfil = btnImagenPerfil;
	}

	public JButton getBtnIzquierdo() {
		return btnIzquierdo;
	}

	public void setBtnIzquierdo(JButton btnIzquierdo) {
		this.btnIzquierdo = btnIzquierdo;
	}

	public JButton getBtnCentral() {
		return btnCentral;
	}

	public void setBtnCentral(JButton btnCentral) {
		this.btnCentral = btnCentral;
	}

	public JButton getBtnDerecho() {
		return btnDerecho;
	}

	public void setBtnDerecho(JButton btnDerecho) {
		this.btnDerecho = btnDerecho;
	}

	public JLabel getLblNyApe() {
		return lblNyApe;
	}

	public void setLblNyApe(JLabel lblNyApe) {
		this.lblNyApe = lblNyApe;
	}
	
	public JLabel getLblUsuario() {
		return lblUsuario;
	}

	public void setLblUsuario(JLabel lblUsuario) {
		this.lblUsuario = lblUsuario;
	}

	public JLabel getLblAmigosEnComun() {
		return lblAmigosEnComun;
	}

	public void setLblAmigosEnComun(JLabel lblAmigosEnComun) {
		this.lblAmigosEnComun = lblAmigosEnComun;
	}

	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}
	
	
}
